<template>
  <el-scrollbar height="100%">
    <kdcrud :options="options" :model="model"></kdcrud>
  </el-scrollbar>
</template>

<script setup>
import { getCurrentInstance } from "vue";
import options from "./options";
import model from "./model";
import { useStore } from "vuex";
import { $getPark } from "../../utils/api.js";
const store = useStore();
const { proxy } = getCurrentInstance();

// 下拉列表
(async () => {
  const res = await proxy.$getMessageTypeList();
  options.config.formItemArr[2].options.optionArr = res.results.map(
    (item, index) => {
      return {
        value: index,
        label: item.name,
      };
    }
  );
})();

// 级联列表
(async () => {
  const res = await $getPark({ tenant_id: "389767" });
  console.log(res);
  options.config.formItemArr[3].options.optionArr = res.results.map((item) => {
    const children = item.children.map((child) => {
      return {
        label: child.name,
        value: child.id,
      };
    });
    return {
      label: item.name,
      children,
    };
  });
  console.log(3, options.config.formItemArr[3].options.optionArr);
})();
</script>

<style lang="scss" scoped>
:deep(.el-form) {
  display: flex;
}
:deep(.el-form-item__content) {
  margin-left: 10px !important;
}
:deep(.el-pagination) {
  display: flex;
  justify-content: center;
}
</style>
